//定义
var deviceLinkTypeMap = {};
deviceLinkTypeMap["ac"] =  "空调";
deviceLinkTypeMap["music"] = "音乐";
deviceLinkTypeMap["tv"] = "电视";
deviceLinkTypeMap["node"] = "节点";
deviceLinkTypeMap["dimmer"] = "调光";
deviceLinkTypeMap["card"] = "读卡器";

//房间状态定义
var roomStatusMap = {};
roomStatusMap["1"] =  "脏空";
roomStatusMap["2"] = "入住";
roomStatusMap["3"] = "故障";
roomStatusMap["4"] = "干净";
roomStatusMap["5"] = "预退";
roomStatusMap["6"] = "预约";
var componentStatusMap = {};
componentStatusMap["on"] =  "开";
componentStatusMap["off"] = "关";
componentStatusMap["blink"] = "闪烁";

function loadRoomStatus(key) {
	printLog('-------------'+key);
	return roomStatusMap[key];
}

function fiterRoomStatu(data) {
	if('2'==data.status) {
		//入住状态
		showCustomerLiveInfo(data.id);
	}else if('4'==data.status){
		//干净状态
		operationCustomerLive(data.id);
	}else if('3'==data.status) {
		//故障
		showMsg(data.roomNo+"...故障中...");
	}else if('1'==data.status) {
		//脏空
		showMsg(data.roomNo+"...脏空房等待打扫...");
	}else if('5'==data.status) {
		//预退
		showMsg(data.roomNo+"...预退中...");
	}
}
//住户登记
function operationCustomerLive(objId) {
	createFromWindowOptions({
		title:"顾客入住登记",
		maximizable:true,
		width:1000,
		href:"customer.do?liveCustomer&roomId="+objId,
		callback:function(d) {
			var f  = d.find('#liveCustomerForm');
			var validate = f.form("validate");
			if (validate) {
				f.submit();
            } else {
                return false;
            }
		},
		enableSaveButton:true
	});
}
//住户信息
function showCustomerLiveInfo(objId) {
//		createFromWindow("顾客入住信息", "customer.do?liveCustomerInfo&roomId="+objId,
//				null, null,false);
	createFromWindowOptions({
		title:"顾客入住信息",
		width:1000,
		maximizable:true,
		href:"customer.do?liveCustomerInfo&roomId="+objId,
		saveButtonText:'离开',
		callback:function(d) {
			var f  = d.find('#liveCustomerInfoForm');
//				var validate = f.form("validate");
//				if (validate) {
				f.submit();
//	            } else {
//	                return false;
//	            }
		},
		enableSaveButton:true
	});
	
}